﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Lesson
{
    public partial class edit_Reading : System.Web.UI.Page
    {
        public const string PATH_UPLOAD_pic = "~/Content/testdata/picture/";
        public const string PATH_UPLOAD_au = "~/Content/testdata/audio/";
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Request.QueryString["id"]);
            string type = Request.QueryString["type"];
            string name = Request.QueryString["name"];
            HttpPostedFile file = Request.Files[0];
            string[] temp = new string[file.FileName.Split('.').Length];
            temp = file.FileName.Split('.');
            string temp2 = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + Session["admin_id"].ToString();
            temp2 += file.FileName;
            if (type == "data:audio")
            {
                file.SaveAs(Server.MapPath(PATH_UPLOAD_au) + "/" + temp2);
                new TblLessonReadingController().Update(id, null, name, temp2, null);
            }

        }
    }
}